import LadderData from "./LadderData";
import { KingShareManager } from "../Public/KingShareManager";
import { KingWXUtil } from "../Public/KingWXUtil";
import { k } from "../Public/K";

/*
 * @Author: LCL 
 * @Date: 2019-03-08 20:36:30
 * @Desc: 游戏UI管理器
*/

const {ccclass, property} = cc._decorator;

@ccclass
export default class LoginControl extends cc.Component {

    @property(cc.Node)
    left2Node: cc.Node = null;

    @property(cc.Node)
    right2Node: cc.Node = null;

    @property(cc.Node)
    left3Node: cc.Node = null;

    @property(cc.Node)
    right3Node: cc.Node = null;

    // onLoad () {}

    start () {
        KingWXUtil.createGameCirc();

        // k.audioManager.playBGByName("game_music1.mp3");
    }

    

    //登录按钮
    public loginBtnClick(){
        // LadderData.getInstance().uiCtr.loginStart();
        this.showLoginAnimation();
    }



    //排行榜按钮
    public rankBtnClick(){
        LadderData.getInstance().uiCtr.showRank();
    }

    //分享按钮
    public shareBtnClick(){
        KingShareManager.getInstance().onShare(0,(data)=>{
            if(data.code == 1){
            }
            else{
            }
        },"");
    }


    showLoginAnimation(){
        // let actionFadeInOut = cc.sequence(
        //     cc.spawn(cc.moveTo(0.5, cc.v2(141, 393)), cc.fadeOut(0.5)),
        //     cc.callFunc(this.onFadeOutFinish, this)
        // )
        // this.zhandouliUpL.node.runAction(actionFadeInOut);
        let timteCount = 0.3;

        this.left2Node.runAction( cc.moveTo( timteCount ,new cc.Vec2(-563,0)));
        this.right2Node.runAction( cc.moveTo( timteCount ,new cc.Vec2(563,0)));

        setTimeout(()=>{
            this.left3Node.runAction( cc.moveTo( timteCount ,new cc.Vec2(-563,0)));
            this.right3Node.runAction( cc.moveTo( timteCount ,new cc.Vec2(563,0)));
        },timteCount*1000);

        setTimeout(()=>{
            LadderData.getInstance().uiCtr.loginStart();
            this.left2Node.position = new cc.Vec2(-375/2,0);
            this.right2Node.position = new cc.Vec2(375/2,0);
            this.left3Node.position = new cc.Vec2(-375/2,0);
            this.right3Node.position = new cc.Vec2(375/2,0);
        },timteCount*1000*2);
    }

    

    // update (dt) {}
}

/*
public void TEXT1() 
{
	int textNum = 1;
	if (textNum == 1) 
	{
		textNum = 2;
    }
}
public void TEXT2()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
public void TEXT3()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT4()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT5()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT6()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT8()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT9()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT10()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT11()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT12()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT13()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT14()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT15()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT16()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT17()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
*/
